METHOD:  Window::prompt

window.prompt(message[, defaultInput])

This method displays a dialog box prompting the user for some input. The optional defaultInput parameter specifies the text that initially appears in the input field.

The following example prompts the user for their name and then writes a personalized greeting to the page.

Code:
<body onload=greeting()>

<script language="JavaScript">
function greeting() {
    y = (prompt("Please enter your name.", "Type name here"))
    document.write("Hello " + y)
}
</script>

Output:

Copyright 2000 by Infinite Software Solutions, Inc.
Trademark Information